package com.yorge.client;

import com.yorge.entities.CommonResult;
import com.yorge.entities.Payment;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

@Component
@FeignClient(value = "CLOUD-PAYMENT-SERVER")
public interface PaymentClient {

    // PathVariable 注解，必须加别名
    @RequestMapping("/payment/getPayment/{id}")
    public CommonResult<Payment> getPayment(@PathVariable("id") Long id);

    @PostMapping("/payment/addPayment")
    public CommonResult<String> addPayment(@RequestBody Payment payment);

    @RequestMapping("/payment/timeOut")
    public String timeOut() throws InterruptedException;
}
